package org.footballmanager.pandafootball.system.form.impl;

import lombok.Getter;
import lombok.Setter;
import org.footballmanager.pandafootball.system.domain.FootClub;
import org.footballmanager.pandafootball.system.form.SearchForm;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;

import java.io.Serializable;

@Setter
@Getter
public class FootClubSearchForm extends SearchForm implements Serializable {
    private static final long serialVersionUID = 8090668615941861524L;
    protected String userName;
    protected Long sj;
    //用于首页
    protected Integer bscc;

    public Example buildSearchCommond() {
        Example example = new Example(FootClub.class);
        Example.Criteria criteria = example.createCriteria();
        if (!StringUtils.isEmpty(sj)) {
            criteria.andEqualTo("sj", sj);
        }
        criteria.andEqualTo("delFlag", 0);
        example.orderBy("jf").desc().orderBy("jsq").desc().orderBy("jq").desc();
        return example;
    }

}
